﻿@model Model.Order
@{
    ViewBag.Title = "Index1";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


<div class="user-order-box">
    <div class="user-order">
        <div class="home-location-box">
            <div class="goods-location">
                <i><img src=" ~/Content/images/icon/home.png" alt="" width="18" height="18"></i>
                <span><a href="">首页</a></span>
                <span>></span>
                <span><a href="">订单管理</a></span>

            </div>


        </div>

        <div class="user-order-main">
            <!--个人中心左侧栏目-->
            <div class="home-box-left">
                <ul>
                    <h3><i><img src=" ~/Content/images/icon/user-products.png" width="18" alt="18"></i>&nbsp;订单中心</h3>
                    <li><a href="~/Shopping/Index">我的购物车</a></li>
                    <li><a href="~/Order/Index1">订单管理</a></li>
                </ul>
                <ul>
                    <h3><i><img src=" ~/Content/images/icon/us.png" width="18" alt="18"></i>&nbsp;会员中心</h3>
                    <li><a href="~/User/Index">个人信息</a></li>
                    <li><a href="~/Address/Index">收货地址</a></li>
                </ul>
            </div>
            <!--个人中心左侧栏目end!-->

            <div class="user-order-manager">
                <div class="order-manager-title">
                    <a href="" id="orderbtn" class="active">订单列表</a>
                </div>

                <!--订单列表-->
                <div id="tb1">
                    <div class="order-manager-title2">
                        <table width="1080" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="79" height="40">订单状态</td>
                                <td width="311">
                                    <label>
                                        <select name="select">
                                            <option>所有订单</option>
                                            <option>待付款</option>
                                            <option>待发货</option>
                                            <option>已发货</option>
                                            <option>已完成</option>
                                        </select>
                                    </label>
                                    <input type="submit" name="Submit" value="查询" class="order-btn" />
                                </td>
                                <td width="70">订单号</td>
                                <td width="185">
                                    <label>
                                        <input type="text" name="textfield" class="order-input" />
                                    </label>
                                </td>
                                <td width="435">
                                    <label>
                                        <input type="submit" name="Submit" value="查询" class="order-btn" />
                                    </label>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div class="order-manager-title3">
                        <!--订单循环-->

                        @{
                            foreach (var item in ViewBag.bg)
                            {
                                <table width="1080" border="0" cellpadding="0" cellspacing="0" bordercolor="#d5d5d5" bgcolor="#fff">

                                    <tr>
                                        <td width="8%" height="51" align="center">订单号：</td>
                                        <td width="20%"> @item.OrderId</td>
                                        <td colspan="2">下单时间：@item.OrderTime</td>
                                        <td width="25%"><a href=""> 深圳火电科技贸易有限公司</a></td>
                                        <td width="18%" colspan="2">
                                            <img src=" ~/Content/images/icon/kefu.png" width="20" height="20">
                                            <img src=" ~/Content/images/icon/qq.png" width="20" height="20">
                                            <img src=" ~/Content/images/icon/ali.gif" width="16" height="16">
                                        </td>

                                    </tr>
                                    <tr>
                                        <td height="126" align="center"><img src=" ~/Content/@item.ProductPrth" width="60" height="60" /></td>
                                        <td><a href="">@item.ProductName</a></td>
                                        <td width="6%" align="center">
                                            <p>@item.Count</p>
                                        </td>
                                        <td width="19%" align="center">@item.Price</td>
                                        <td align="center"><h4>@item.Price</h4><p><span>(免运费)</span></p><p><span>在线付款</span></p></td>
                                        <td align="center">
                                            @if (item.IsTake == "未发货")
                                            {
                                                <a href="" class="dfk">@item.IsTake</a>
                                            }
                                            else if (item.IsTake == "已发货")
                                            {
                                                <a href="" class="dfk">未收货</a>
                                            }
                                            else if (item.IsTake == "未支付")
                                            {
                                                <a href="" class="dfk">@item.IsTake</a>
                                            }


                                        </td>
                                        <td align="center">
                                            @if (item.IsTake == "已发货")
                                            {
                                                <a class="sh" id="sh" data-id="@item.Id">确认收货</a>
                                            }
                                            else if (item.IsTake == "未支付")
                                            {
                                                <a class="quzhifu" id="quzhifu" data-id="@item.Id">去支付</a>
                                            }
                                            else
                                            {
                                                <a class="quxiao" id="quxiao" data-id="@item.Id">取消订单</a>
                                            }
                                        </td>
                                    </tr>
                                </table>
                            }
                        }
                    </div>
                    <!--order-page-->
                    <div class="order-page">

                        <table width="400" border="0">
                            <tr>
                                <td width="82" align="right"><a href="" class="order-page-up"><<</a></td>
                                <td width="235">
                                    <ul>
                                        <li><a href="">1</a></li>
                                        <li><a href="">2</a></li>
                                        <li><a href="">3</a></li>
                                        <li><a href="">4</a></li>
                                        <li><a href="">5</a></li>
                                    </ul>
                                </td>
                                <td width="109" align="left"><a href="" class="order-page-down">>></a></td>
                            </tr>
                        </table>
                    </div>
                    <!--order-page end!-->
                </div>
            </div>
            <!--回收站列表end!-->
        </div>
    </div>
</div>
<script src="~/Content/js/jquery-1.8.2.min.js"></script>

<script>
    $(".sh").click(function () {
        var id = $(this).data("id");
        $.post("/Order/Update", { Id: id }, function (res) {
            if (res.Success) {
                alert("已收货")
                window.location.href = "/Order/Index1";
            }
        })
    });
    $(".quzhifu").click(function () {
        var id = $(this).data("id");

        window.location.href = "/ZhiFu1/Index?id=" + id;
        @*$.post("/Order/Update", { Id: id }, function (res) {
            if (res.Success) {
                alert("已收货")
                window.location.href = "/Order/Index1";
            }
        })*@
    });
    $(".quxiao").click(function () {
        var id = $(this).data("id");
        $.post("/Order/Delete", { Id: id }, function (res) {
            if (res.Success) {
                alert("已取消订单")
                window.location.href = "/Order/Index1";
            }
        })
    });
</script>



